<%@page import="com.gjintel.sdk.util.ProcessDefinitionCache,org.activiti.engine.RepositoryService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib uri="http://www.framework.com/taglib" prefix="frame"%>
  <head>
	<title>公共平台 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- 样式文件的引入 -->
	<link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css">
	<!-- jqueryUI JS文件的引入 -->
	<script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
	<!-- jqueryUI国际化 -->
	<script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
	<!-- 开发使用的公用js方法 -->
	<script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
	<!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
	<script type="text/javascript">var ctx = '${ctx}';var actionExt = "action";var i18n = new Object();</script>
	<script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
	<%@ include file="/commons/global.jsp"%>
	<%@ include file="/commons/meta.jsp" %>
	<%@ include file="/commons/include-base-styles.jsp" %>
	<%@ include file="/commons/include-jquery-ui-theme.jsp" %>
	<title>流程列表</title>

	<script src="${ctx }/js/commons/jquery-1.8.3.js" type="text/javascript"></script>
    <script src="${ctx }/js/commons/plugins/jui/jquery-ui-${themeVersion }.min.js" type="text/javascript"></script>
	<script type="text/javascript">
	$(function() {
		// 跟踪
	    $('.trace').click(graphTrace);
	});
	/**
	 * 查看流程追踪
	 */	
	 function openProcessTracePicture(id){
		top.$('#firstLevelDialog').dialog({    
		    title:"流程追踪",  
		    iconCls:'icon-view',
		    width: 900,    
		    height: 520,    
		    closed: false,    
		    inline : true,
		    cache: false,    
		    href: "${ctx }/workflow/process/trace?processInstanceId=" + id,    
		    modal: true,
		    buttons : [{
					text:"取消",
					iconCls:'icon-cancel',
					handler:function(){
						top.$('#firstLevelDialog').dialog('close');
					}}]
		});
	}
	</script>
</head>

<body>
	<%
	RepositoryService repositoryService = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext()).getBean(org.activiti.engine.RepositoryService.class);
	ProcessDefinitionCache.setRepositoryService(repositoryService);
	%>
	<table width="100%" class="need-border">
		<thead>
			<tr>
				<th>执行ID</th>
				<th>流程实例ID</th>
				<th>流程定义ID</th>
				<th>当前节点</th>
				<th>是否挂起</th>
			</tr>
		</thead>
		<tbody align="center">
			<c:forEach items="${page.result }" var="p">
			<c:set var="pdid" value="${p.processDefinitionId }" />
			<c:set var="activityId" value="${p.activityId }" />
			<tr>
				<td>${p.id }</td>
				<td>${p.processInstanceId }</td>
				<td>${p.processDefinitionId }</td>
				<td><a href='#' onclick='openProcessTracePicture(${p.id})'><%=ProcessDefinitionCache.getActivityName(pageContext.getAttribute("pdid").toString(), pageContext.getAttribute("activityId").toString()) %></a></a></td>
				<td>${p.suspended }</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	<tags:pagination page="${page}" paginationSize="${page.pageSize}"/>
	<!-- 办理任务对话框 -->
	<div id="handleTemplate" class="template"></div>

</body>
</html>
